<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html id="htmlId">
<head>
    <title>Coverage Report :: SpriteTest</title>
    <style type="text/css">
        @import "../../.css/coverage.css";
    </style>
</head>

<body>
<div class="header"></div>

<div class="content">
    <div class="breadCrumbs">
        [ <a href="../../index.html">all classes</a> ]
        [ <a href="../index.html">nl.tudelft.jpacman.sprite</a> ]
    </div>

    <h1>Coverage Summary for Class: SpriteTest (nl.tudelft.jpacman.sprite)</h1>

    <table class="coverageStats">
        <tr>
            <th class="name">Class</th>
            <th class="coverageStat
">
                Class, %
            </th>
            <th class="coverageStat
">
                Method, %
            </th>
            <th class="coverageStat
">
                Line, %
            </th>
        </tr>
        <tr>
            <td class="name">SpriteTest</td>
            <td class="coverageStat">
  <span class="percent">
    0%
  </span>
                <span class="absValue">
    (0/ 1)
  </span>
            </td>
            <td class="coverageStat">
  <span class="percent">
    0%
  </span>
                <span class="absValue">
    (0/ 11)
  </span>
            </td>
            <td class="coverageStat">
  <span class="percent">
    0%
  </span>
                <span class="absValue">
    (0/ 17)
  </span>
            </td>
        </tr>

    </table>

    <br/>
    <br/>


    <div class="sourceCode"><i>1</i>&nbsp;package nl.tudelft.jpacman.sprite;
        <i>2</i>&nbsp;
        <i>3</i>&nbsp;import static org.assertj.core.api.Assertions.assertThatThrownBy;
        <i>4</i>&nbsp;import static org.assertj.core.api.Assertions.assertThat;
        <i>5</i>&nbsp;
        <i>6</i>&nbsp;import java.io.IOException;
        <i>7</i>&nbsp;
        <i>8</i>&nbsp;import org.junit.jupiter.api.BeforeEach;
        <i>9</i>&nbsp;import org.junit.jupiter.api.Test;
        <i>10</i>&nbsp;
        <i>11</i>&nbsp;/**
        <i>12</i>&nbsp; * Verifies the loading of sprites.
        <i>13</i>&nbsp; *
        <i>14</i>&nbsp; * @author Jeroen Roosen
        <i>15</i>&nbsp; */
        <i>16</i>&nbsp;@SuppressWarnings(&quot;magicnumber&quot;)
        <b class="nc"><i>17</i>&nbsp;public class SpriteTest {</b>
        <i>18</i>&nbsp;
        <i>19</i>&nbsp; private Sprite sprite;
        <i>20</i>&nbsp; private SpriteStore store;
        <i>21</i>&nbsp;
        <i>22</i>&nbsp; private static final int SPRITE_SIZE = 64;
        <i>23</i>&nbsp;
        <i>24</i>&nbsp; /**
        <i>25</i>&nbsp; * The common fixture of this test class is
        <i>26</i>&nbsp; * a 64 by 64 pixel white sprite.
        <i>27</i>&nbsp; *
        <i>28</i>&nbsp; * @throws java.io.IOException
        <i>29</i>&nbsp; * when the sprite could not be loaded.
        <i>30</i>&nbsp; */
        <i>31</i>&nbsp; @BeforeEach
        <i>32</i>&nbsp; public void setUp() throws IOException {
        <b class="nc"><i>33</i>&nbsp; store = new SpriteStore();</b>
        <b class="nc"><i>34</i>&nbsp; sprite = store.loadSprite(&quot;/sprite/64x64white.png&quot;);</b>
        <i>35</i>&nbsp; }
        <i>36</i>&nbsp;
        <i>37</i>&nbsp; /**
        <i>38</i>&nbsp; * Verifies the width of a static sprite.
        <i>39</i>&nbsp; */
        <i>40</i>&nbsp; @Test
        <i>41</i>&nbsp; public void spriteWidth() {
        <b class="nc"><i>42</i>&nbsp; assertThat(sprite.getWidth()).isEqualTo(SPRITE_SIZE);</b>
        <i>43</i>&nbsp; }
        <i>44</i>&nbsp;
        <i>45</i>&nbsp; /**
        <i>46</i>&nbsp; * Verifies the height of a static sprite.
        <i>47</i>&nbsp; */
        <i>48</i>&nbsp; @Test
        <i>49</i>&nbsp; public void spriteHeight() {
        <b class="nc"><i>50</i>&nbsp; assertThat(sprite.getHeight()).isEqualTo(SPRITE_SIZE);</b>
        <i>51</i>&nbsp; }
        <i>52</i>&nbsp;
        <i>53</i>&nbsp; /**
        <i>54</i>&nbsp; * Verifies that an IOException is thrown when the resource could not be
        <i>55</i>&nbsp; * loaded.
        <i>56</i>&nbsp; *
        <i>57</i>&nbsp; * @throws java.io.IOException
        <i>58</i>&nbsp; * since the sprite cannot be loaded.
        <i>59</i>&nbsp; */
        <i>60</i>&nbsp; @Test
        <i>61</i>&nbsp; public void resourceMissing() throws IOException {
        <b class="nc"><i>62</i>&nbsp; assertThatThrownBy(() -&gt; store.loadSprite(&quot;/sprite/nonexistingresource.png&quot;))</b>
        <b class="nc"><i>63</i>&nbsp; .isInstanceOf(IOException.class);</b>
        <i>64</i>&nbsp; }
        <i>65</i>&nbsp;
        <i>66</i>&nbsp; /**
        <i>67</i>&nbsp; * Verifies that an animated sprite is correctly cut from its base image.
        <i>68</i>&nbsp; */
        <i>69</i>&nbsp; @Test
        <i>70</i>&nbsp; public void animationWidth() {
        <b class="nc"><i>71</i>&nbsp; AnimatedSprite animation = store.createAnimatedSprite(sprite, 4, 0,</b>
        <i>72</i>&nbsp; false);
        <b class="nc"><i>73</i>&nbsp; assertThat(animation.getWidth()).isEqualTo(16);</b>
        <i>74</i>&nbsp; }
        <i>75</i>&nbsp;
        <i>76</i>&nbsp; /**
        <i>77</i>&nbsp; * Verifies that an animated sprite is correctly cut from its base image.
        <i>78</i>&nbsp; */
        <i>79</i>&nbsp; @Test
        <i>80</i>&nbsp; public void animationHeight() {
        <b class="nc"><i>81</i>&nbsp; AnimatedSprite animation = store.createAnimatedSprite(sprite, 4, 0,</b>
        <i>82</i>&nbsp; false);
        <b class="nc"><i>83</i>&nbsp; assertThat(animation.getHeight()).isEqualTo(64);</b>
        <i>84</i>&nbsp; }
        <i>85</i>&nbsp;
        <i>86</i>&nbsp; /**
        <i>87</i>&nbsp; * Verifies that an split sprite is correctly cut from its base image.
        <i>88</i>&nbsp; */
        <i>89</i>&nbsp; @Test
        <i>90</i>&nbsp; public void splitWidth() {
        <b class="nc"><i>91</i>&nbsp; Sprite split = sprite.split(10, 11, 12, 13);</b>
        <b class="nc"><i>92</i>&nbsp; assertThat(split.getWidth()).isEqualTo(12);</b>
        <i>93</i>&nbsp; }
        <i>94</i>&nbsp;
        <i>95</i>&nbsp; /**
        <i>96</i>&nbsp; * Verifies that an split sprite is correctly cut from its base image.
        <i>97</i>&nbsp; */
        <i>98</i>&nbsp; @Test
        <i>99</i>&nbsp; public void splitHeight() {
        <b class="nc"><i>100</i>&nbsp; Sprite split = sprite.split(10, 11, 12, 13);</b>
        <b class="nc"><i>101</i>&nbsp; assertThat(split.getHeight()).isEqualTo(13);</b>
        <i>102</i>&nbsp; }
        <i>103</i>&nbsp;
        <i>104</i>&nbsp; /**
        <i>105</i>&nbsp; * Verifies that a split that isn&#39;t within the actual sprite returns an empty sprite.
        <i>106</i>&nbsp; */
        <i>107</i>&nbsp; @Test
        <i>108</i>&nbsp; public void splitOutOfBounds() {
        <b class="nc"><i>109</i>&nbsp; Sprite split = sprite.split(10, 10, 64, 10);</b>
        <b class="nc"><i>110</i>&nbsp; assertThat(split).isInstanceOf(EmptySprite.class);</b>
        <i>111</i>&nbsp; }
        <i>112</i>&nbsp;}
    </div>
</div>

<div class="footer">

    <div style="float:right;">generated on 2023-04-25 16:45</div>
</div>
</body>
</html>
